namespace RivercrabNet
{
    using System;
    using System.Drawing;

    public class BarShape : BaseShape
    {
        private RivercrabNet.BarStyle barStyle = RivercrabNet.BarStyle.Bar;
        private string colorFlag = ("CandleShape.UpDownFlag." + Common.GetGuid());
        private string displayName = string.Empty;
        private Brush down_lineBrush;
        private Color down_lineColor;
        private Pen _downPen;
        private int lineWidth = 1;
        private Brush up_lineBrush;
        private Color up_lineColor;
        private Pen up_Pen;
        private Brush up_TransparentBrush;

        ~BarShape()
        {
            if (this.up_lineBrush != null)
            {
                this.up_lineBrush.Dispose();
            }
            if (this.down_lineBrush != null)
            {
                this.down_lineBrush.Dispose();
            }
            if (this.up_TransparentBrush != null)
            {
                this.up_TransparentBrush.Dispose();
            }
            if (this.up_Pen != null)
            {
                this.up_Pen.Dispose();
            }
            if (this._downPen != null)
            {
                this._downPen.Dispose();
            }
        }

        public RivercrabNet.BarStyle BarStyle
        {
            get
            {
                return this.barStyle;
            }
            set
            {
                this.barStyle = value;
            }
        }

        public string ColorFlag
        {
            get
            {
                return this.colorFlag;
            }
            set
            {
                this.colorFlag = value;
            }
        }

        public string DisplayName
        {
            get
            {
                return this.displayName;
            }
            set
            {
                this.displayName = value;
            }
        }

        public Brush Down_lineBrush
        {
            get
            {
                return this.down_lineBrush;
            }
            set
            {
                this.down_lineBrush = value;
            }
        }

        public Color Down_lineColor
        {
            get
            {
                return this.down_lineColor;
            }
            set
            {
                this.down_lineColor = value;
                if (this.down_lineBrush != null)
                {
                    this.down_lineBrush.Dispose();
                }
                this.Down_lineBrush = new SolidBrush(value);
                if (this._downPen != null)
                {
                    this._downPen.Dispose();
                }
                this._downPen = new Pen(value);
            }
        }

        public Pen Down_Pen
        {
            get
            {
                return this._downPen;
            }
            set
            {
                this._downPen = value;
            }
        }

        public int LineWidth
        {
            get
            {
                return this.lineWidth;
            }
            set
            {
                this.lineWidth = value;
            }
        }

        public Brush Up_LineBrush
        {
            get
            {
                return this.up_lineBrush;
            }
            set
            {
                this.up_lineBrush = value;
            }
        }

        public Color Up_LineColor
        {
            get
            {
                return this.up_lineColor;
            }
            set
            {
                this.up_lineColor = value;
                if (this.up_lineBrush != null)
                {
                    this.up_lineBrush.Dispose();
                }
                this.up_lineBrush = new SolidBrush(value);
                if (this.up_TransparentBrush != null)
                {
                    this.up_TransparentBrush.Dispose();
                }
                this.up_TransparentBrush = new SolidBrush(Color.FromArgb(100, value));
                if (this.up_Pen != null)
                {
                    this.up_Pen.Dispose();
                }
                this.up_Pen = new Pen(value);
            }
        }

        public Pen Up_Pen
        {
            get
            {
                return this.up_Pen;
            }
            set
            {
                this.up_Pen = value;
            }
        }

        public Brush Up_TransparentBrush
        {
            get
            {
                return this.up_TransparentBrush;
            }
            set
            {
                this.up_TransparentBrush = value;
            }
        }
    }
}

